<script type="text/javascript" src="http://<?php echo $doctor['consult_url']?>/cgi-bin/pubinfo.cgi"></script>
<script type="text/javascript" src="http://<?php echo $doctor['consult_url']?>/plugindef.js"></script>

<script>
    $(function(){
        var timeout3 = 4000;//Save Time Interval
        var timer3;

        $(document).ready(function() {
            timer3 = $.timer(timeout3, function() {
                loadChat();
            });
        });

        $("#chat_submit").button();

        function loadChat(){
            $.ajax({
                type: "POST",
                url: "../ajax/loadChat",
                data: {
                    p_id:$("input#p_id").val(),
                    c_id:$("input#c_id").val()
                },
                dataType: "html",
                success: function(data) {
                    $("#chat_div").html(data);
                }
            });
        }

        $("#frmChat").submit(function(){
            $.ajax({
                type: "POST",
                url: "../ajax/sendChat",
                data: {
                    p_id:$("input#p_id").val(),
                    c_id:$("input#c_id").val(),
                    chat_txt:$("input#chat_txt").val(),
                    from:$("input#from").val()
                },
                dataType: "html",
                success: function(data) {
                    $("#chat_div").html($("#chat_div").html()+"<br>กำลังส่งข้อความ");
                    $("input#chat_txt").val("");
                }
            });
            return false;
        });
    });
</script>

<!--<OBJECT ID="MediaPlayer0" WIDTH=290 HEIGHT=290
        CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
        STANDBY="Loading Windows Media Player components..."
        TYPE="application/x-oleobject">
    <param name="animationatstart" value="true">
    <param name="transparentatstart" value="true">
    <param name="autostart" value="true">
    <param name="showcontrols" value="false">
    <param name="ShowStatusBar" value="false">

    <EMBED TYPE="application/x-mplayer2"
           src="mms://192.168.1.5:8080"
           NAME="MediaPlayer0"
           WIDTH=290
           HEIGHT=290
           showcontrols="false" showstatusbar="0">
    </EMBED>
</OBJECT>
<OBJECT id="VIDEO" width="640" height="480" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-mplayer2">
			<PARAM NAME="URL" VALUE="mms://127.0.0.1:9000">
			<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
			<PARAM NAME="AutoStart" VALUE="True">
			<PARAM name="uiMode" value="full">
			<PARAM name="PlayCount" value="9999">
			<PARAM NAME="stretchtofit" value="true">

                        <EMBED SRC="mms://127.0.0.1:9000"
                               WIDTH="290" HEIGHT="290"
                               autostart="1"
                               TYPE="application/x-mplayer2"
                               ShowControls="0" ShowStatusBar="0"
                               ShowTracker="0" EnableContextMenu="0"
                               ShowPositionControls="0"
                               name="MediaPlayer">
                       </EMBED>
</OBJECT>



-->
<script language="javascript">
    function butAVIOperClick()
    {
        alert(VAtCtrl.ControlButtonOpts);
        /*if (VAtCtrl.AVIStatus != 2)
        {
                // start recording
                VAtCtrl.StartAVIConversion();
                 alert("start");
        }
        else
        {
                VAtCtrl.StopAVIConversion();
                 alert("stop");
        }*/
    }
</script>

<SCRIPT language=JavaScript>
    <!--
    /*if ((navigator.appName == "Microsoft Internet Explorer")&&(navigator.platform != "MacPPC"))
     {
               document.write("<OBJECT ID=\"VAtCtrl\" WIDTH=440 HEIGHT=400 name=\"VAtCtrl\"");
               document.write(" CLASSID=CLSID:210D0CBC-8B17-48D1-B294-1A338DD2EB3A");
               document.write(" CODEBASE=\"/VatDec.cab#version=1,0,0,68\">");
               document.write("<PARAM NAME=\"VSize\" VALUE=\"SIF\">");
               document.write("<PARAM NAME=\"Language\" VALUE=\"en\">");
               document.write("<PARAM NAME=\"Deblocking\" VALUE=\"true\">");
               document.write("<PARAM NAME=\"DisplayTimeFormat\" VALUE=\"1\">");
               document.write("<PARAM NAME=\"DigitalZoomEnableChk\" VALUE=\"true\">");
               document.write("<PARAM NAME=\"DigitalZoomEdit\" VALUE=\"true\">");
               document.write("<PARAM NAME=\"ControlButtonOpts\" VALUE=\"127\">");
               document.write("<PARAM NAME=\"Url\" VALUE=\"http://10.128.52.21/cgi-bin/control.cgi\">");
               document.write("</OBJECT>");
     }*/
    //-->

    if ((navigator.appName == "Microsoft Internet Explorer")&&(navigator.platform != "MacPPC"))
    {
        document.write("<OBJECT ID=\"VitCtrl\" WIDTH=720 HEIGHT=576 name=\"VitCtrl\"" );
        document.write(" CLASSID=CLSID:70EDCF63-CA7E-4812-8528-DA1EA2FD53B6");
        document.write(" CODEBASE=\"VitaminCtrl_2_1_0_24.cab#version=2,1,0,24\">");
        document.write("<PARAM NAME=\"VSize\" VALUE=\"SIF\">");
        document.write("<PARAM NAME=\"Language\" VALUE=\"EN\">");
        document.write("<PARAM NAME=\"ClickEventHandler\" VALUE=\"3\">");
//        document.write("<PARAM NAME=\"RemoteIPAddr\" VALUE=\"10.128.52.21\">");
        document.write("<PARAM NAME=\"RemoteIPAddr\" VALUE=\"<?php echo $url?>\">");
        document.write("<PARAM NAME=\"UserName\" VALUE=\"<?php echo $username?>\">");
        document.write("<PARAM NAME=\"Password\" VALUE=\"<?php echo $password?>\">");
        document.write("<PARAM NAME=\"ControlButtonOpts\" VALUE=\"127\">");
        document.write("<PARAM NAME=\"AutoReconnect\" VALUE=\"true\">");
        document.write("<PARAM NAME=\"ServerModelType\" VALUE=\"5\">");
        document.write("</OBJECT>");
    }
</SCRIPT>

<table>
    <tr>
        <td>
            <table width="200" cellspacing="0" cellpadding="0" border="1">
                <tbody><tr><td height="10" colspan="5">&nbsp;</td></tr>
                    <tr height="37"><td width="29">&nbsp;</td>
                        <td width="37"><img border="0" src="/Telestroke/assets/images/sideleft1.gif"></td>
                        <td width="62"><a target="retframe" href="http://<?php echo $url?>/cgi-bin/camctrl.cgi?move=up"><img border="0" name="ctrlup" src="/Telestroke/assets/images/ctrlup.gif"></a></td>
                        <td width="37"><img border="0" src="/Telestroke/assets/images/sideright1.gif"></td>
                        <td width="34">&nbsp;</td></tr>
                    <tr height="37"><td>&nbsp;</td>
                        <td><a target="retframe" href="http://<?php echo $url?>/cgi-bin/camctrl.cgi?move=left"><img border="0" name="ctrlleft" src="/Telestroke/assets/images/ctrlleft.gif"></a></td>
                        <td><a target="retframe" href="http://<?php echo $url?>/cgi-bin/camctrl.cgi?move=home"><img border="0" name="ctrlhome" src="/Telestroke/assets/images/ctrlhome.gif"></a></td>
                        <td><a target="retframe" href="http://<?php echo $url?>/cgi-bin/camctrl.cgi?move=right"><img border="0" name="ctrlright" src="/Telestroke/assets/images/ctrlright.gif"></a></td>
                        <td>&nbsp;</td></tr>
                    <tr height="37"><td>&nbsp;</td>
                        <td><img border="0" src="/Telestroke/assets/images/sideleft2.gif"></td>
                        <td><a target="_self" href="http://<?php echo $url?>/cgi-bin/camctrl.cgi?move=down" ><img border="0" name="ctrldown" src="/Telestroke/assets/images/ctrldown.gif"></a></td>
                        <td><img border="0" src="/Telestroke/assets/images/sideright2.gif"></td>
                        <td>&nbsp;</td></tr>
                    <tr><td colspan="4"><iframe name="retframe" style="display: none"></iframe></td></tr>
                </tbody>
            </table>
        </td>
        <td>
<div id="display_image">
                <script type="text/javascript">
                    <!--
                    // The ActiveX plug-in
                    document.write("<object id=\"" + PLUGIN_ID + "\" width=150 height=150");
                    document.write(" standby=\"Loading plug-in...\" classid=CLSID:" + CLASS_ID);
                    document.write(" codebase=\"/" + PLUGIN_NAME + "#version=" + PLUGIN_VER + "\">");
                    document.write("<param name=\"Url\" VALUE=\"rtsp://<?php echo $doctor['consult_url']?>/" + RTSPAccessName +"\">");
                    document.write("<param name=\"Stretch\" VALUE=\"" + STRETCH + "\">");
                    document.write("<param name=\"VSize\" VALUE=\"CMS\">");
                    document.write("<param name=\"Language\" VALUE=\"" + PLUGIN_LANG + "\">");
                    document.write("<param name=\"ClientOptions\" VALUE=\"567\">");
                    document.write("This is a plug-in (ActiveX). If you see this text, your browser is not support or disable ActiveX.");
                    document.write("<\/object>");
                    //-->
                </script>
            </div>
        </td>        
        <td>
            <form action="" id="frmChat">
                <table width="280" style="border: 1px solid gray;font-size: 14px;background-color: white" cellspacing="0" cellpadding="3">
                    <tr class="ui-widget-header"><td colspan="3">Chat</td></tr>
                    <tr><td colspan="2" align="center">
                            <div id="chat_div" style="width: 270px;height: 80px;overflow: auto;background-color: #eeeeee" align="left">
                            </div></td></tr>
                    <tr><td align="right"><input type="text" id="chat_txt" name="chat_txt" size="30"></td>
                        <td><input id="chat_submit" type="submit" value="ส่ง"></td>
                    </tr>
                </table>
                <input type="hidden" id="p_id" name="p_id" value="<?php echo $p_id?>">
                <input type="hidden" id="c_id" name="c_id" value="<?php echo $c_id?>">
                <input type="hidden" id="from" name="from" value="Dr">
            </form>
        </td>
    </tr>


</table>


